const express = require('express');
const router = express.Router();
const data = [];
for(let i = 1; i < 51; i++)
    data.push({
        id: `${i}`,
        code: `QH2019082700-${i}`,
        brandCode: 'QR',
        brandName: '奇瑞',
        dealerCode: '10145',
        dealerName: '总代名称10145',
        saleOrderCode: 'XS20190827001',
        saleOrderTypeName: '紧急订单',
        orderAmount: 190000,
        currency: 1,
        orderDate: '2019-09-04T02:37:44.918Z',
        status: 1,
        rowVersion: 'string',
        options: ['confirmor', 'close']
    });
router.get('/forCurrentUser', (req, res) => {
    const {pageIndex, pageSize} = req.query;
    res.json({
        message: 'ok',
        payload: {
            content: data,
            pageIndex: parseInt(pageIndex, 10),
            pageSize: parseInt(pageSize, 10),
            totalElements: 50
        }
    });
});
const content = [];
for(let i = 1; i < 5; i++)
    content.push({
        id: `${i}`,
        code: `QH2019082700-${i}`,
        brandCode: 'QR',
        brandName: '奇瑞',
        dealerCode: '10145',
        dealerName: '总代名称10145',
        saleOrderCode: 'XS20190827001',
        saleOrderTypeName: '紧急订单',
        orderAmount: 190000,
        currency: 1,
        orderDate: '2019-09-04T02:37:44.918Z',
        status: 1,
        partId: `${i}`,
        partCode: `partCode-${i}`,
        partName: `partName-${i}`,
        oldPartCode: 'partCode1',
        orderQuantity: 3,
        invoiceAmount: 4,
        invoiceCode: '9865325242',
        missQuantity: 15,
        stockAmount: 7,
        cancelQuantity: 8,
        waitQuantity: 8,
        transforQuantity: 8,
        dealStatus: 1,
        expectedArrivalDate: '2019-09-04T02:37:44.918Z',
        rowVersion: 'string'
    });
router.get('/', (req, res) => {
    const {pageIndex, pageSize} = req.query;
    res.json({
        message: 'ok',
        payload: {
            content,
            pageIndex: parseInt(pageIndex, 10),
            pageSize: parseInt(pageSize, 10),
            totalElements: 50
        }
    });
});

router.put('/confirmor', (req, res) => {
    res.json({
        message: '成功'
    });
});
router.put('/colse', (req, res) => {
    res.json({
        message: '成功'
    });
});
router.post('/approve/import', (req, res) => {
    res.json({
        message: '成功'
    });
});
router.get('/approve/importTemp', (req, res) => {
    res.json({
        message: '导出'
    });
});
router.post('/import', (req, res) => {
    res.json({
        message: '成功'
    });
});
router.get('/importTemp', (req, res) => {
    res.json({
        message: '导出'
    });
});
router.get('/export/forCurrentUser', (req, res) => {
    res.json({
        message: '导出'
    });
});
router.get('/:id', (req, res) => {
    res.json({
        message: 'ok',
        payload: {
            options: ['confirmor', 'close'],
            details: [
                {
                    id: '1',
                    code: 'QH2019082700-1',
                    brandCode: 'QR',
                    brandName: '奇瑞',
                    dealerCode: '10145',
                    dealerName: '总代名称10145',
                    saleOrderCode: 'XS20190827001',
                    saleOrderTypeName: '紧急订单',
                    orderAmount: 190000,
                    currency: 1,
                    orderDate: '2019-09-04T02:37:44.918Z',
                    status: 1,
                    rowVersion: 'string',
                    options: ['confirmor', 'close'],
                    creatorName: '测试人员',
                    createTime: '2019-09-04T02:37:44.918Z',
                    confirmorName: '测试人员',
                    confirmTime: '2019-09-04T02:37:44.918Z',
                    colseConfirmorName: '测试人员',
                    colseConfirmTime: '2019-09-04T02:37:44.918Z',
                    partId: '1',
                    partCode: 'partCode1',
                    partName: 'partName1',
                    oldPartCode: 'partCode1',
                    orderQuantity: 3,
                    invoiceAmount: 4,
                    invoiceCode: '9865325242',
                    missQuantity: 6,
                    stockAmount: 7,
                    cancelQuantity: 8,
                    waitQuantity: 8,
                    transforQuantity: 8,
                    dealStatus: 1,
                    expectedArrivalDate: '2019-09-04T02:37:44.918Z',
                },
                {
                    id: '2',
                    code: 'QH2019082700-2',
                    brandCode: 'QR',
                    brandName: '奇瑞',
                    dealerCode: '10145',
                    dealerName: '总代名称10145',
                    saleOrderCode: 'XS20190827001',
                    saleOrderTypeName: '紧急订单',
                    orderAmount: 190000,
                    currency: 1,
                    orderDate: '2019-09-04T02:37:44.918Z',
                    status: 1,
                    rowVersion: 'string',
                    options: ['confirmor', 'close'],
                    creatorName: '测试人员',
                    createTime: '2019-09-04T02:37:44.918Z',
                    confirmorName: '测试人员',
                    confirmTime: '2019-09-04T02:37:44.918Z',
                    colseConfirmorName: '测试人员',
                    colseConfirmTime: '2019-09-04T02:37:44.918Z',
                    partId: '1',
                    partCode: 'partCode1',
                    partName: 'partName1',
                    oldPartCode: 'partCode1',
                    orderQuantity: 3,
                    invoiceAmount: 4,
                    invoiceCode: '9865325242',
                    missQuantity: 6,
                    stockAmount: 7,
                    cancelQuantity: 8,
                    waitQuantity: 8,
                    transforQuantity: 8,
                    dealStatus: 1,
                    expectedArrivalDate: '2019-09-04T02:37:44.918Z',
                }
            ]
        }
    });
});
module.exports = router;
